package com.redrose.camera.login;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.lifecycle.ViewModelProvider;
import androidx.navigation.NavGraph;

import com.redrose.camera.R;
import com.redrose.camera.base.BaseActivity;
import com.redrose.camera.databinding.ActivityLoginBinding;

public class LoginActivity extends BaseActivity<ActivityLoginBinding> {

    private LoginViewModel mLoginViewModel;


    @Override
    protected void initObserver() {
        mLoginViewModel.getLoginResultLiveData().observe(this,
                s -> mLoginViewModel.openMainActivity(LoginActivity.this));

    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        mLoginViewModel = new ViewModelProvider(this,
                new ViewModelProvider.NewInstanceFactory()).get(LoginViewModel.class);
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void initConfigs() {
        mBinding.setLoginViewModel(mLoginViewModel);
    }

    @Override
    protected void initView() {

    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_login;
    }
}
